package obecto.dataTypes
{
	public class BaseEnum
	{
		private var _value : Number;
	
		private var _name : String;
		public function get name() : String
		{
			return _name;
		}		
		
		public function BaseEnum(aName : String, aValue : Number = NaN)
		{
			_name = aName;
			_value = aValue;
		}
		
		public static function parse(aEnumerationClass : Class, aName : String) : BaseEnum
		{
			return aEnumerationClass[aName];
		}
		
		public function toString() : String
		{
			return _name;
		}
		
		public function valueOf() : Object
		{
			if(!isNaN(_value))
			{
				return _value;
			}
			else
			{
				return this;
			}
		}
	}
}